package com.led.datatype;

import java.sql.ResultSet;
import java.sql.SQLException;

public class UserInfo {
	int id;
	String name;
	String password;
	int canModify;
	int canQuery;
	int canOtherSee;
	int canSeeOthers;

	
	public int getId() {
		return id;
	}
	public String getName() {
		return name;
	}
	public String getPassword() {
		return password;
	}
	public int getCanModify() {
		return canModify;
	}
	public int getCanQuery() {
		return canQuery;
	}
	public int getCanOtherSee() {
		return canOtherSee;
	}
	public int getCanSeeOthers() {
		return canSeeOthers;
	}
	public void setCanSeeOthers(int value) {
		canSeeOthers = value;
	}
	public UserInfo(String name, String password){
		this.name = name;
		this.password = password;
	}
	public UserInfo(String name, String password, int canModify, int canQuery, int canOtherSee, int canSeeOthers){
		this.name = name;
		this.password = password;
		this.canModify = canModify;
		this.canQuery = canQuery;
		this.canOtherSee = canOtherSee;
		this.canSeeOthers = canSeeOthers;
	}
	public UserInfo(ResultSet rs){
		try {
			id = rs.getInt(1);
			name = rs.getString(2);
			password = rs.getString(3);
			canModify = rs.getInt(4);
			canQuery = rs.getInt(5);
			canOtherSee = rs.getInt(6);
			canSeeOthers = rs.getInt(7);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("id=").append(id)
		  .append(" name=").append(name)
		  .append(" canModify=").append(canModify)
		  .append(" canQuery=").append(canQuery)
		  .append(" canOtherSee=").append(canOtherSee)
		  .append(" canSeeOthers=").append(canSeeOthers);
		return sb.toString();
	}
}
